package com.zzj.portalwebsite.Service.Impl;

import com.zzj.portalwebsite.Dao.FeedBackDao;
import com.zzj.portalwebsite.Dao.Impl.FeedBackDaoImpl;
import com.zzj.portalwebsite.Service.FeedBackService;
import com.zzj.portalwebsite.entity.FeedBack;

import java.sql.SQLException;
import java.util.List;

public class FeedBackServiceImpl implements FeedBackService {
    FeedBackDao feedBackDao =null;
    public FeedBackServiceImpl()
    {
        feedBackDao = new FeedBackDaoImpl();
    }
    @Override
    public boolean subInfo(FeedBack feedback) throws Exception {
        return feedBackDao.subInfo(feedback);
    }

    @Override
    public boolean deleteFeedBack(int id) throws SQLException {
        return feedBackDao.deleteFeedBack(id);
    }

    @Override
    public List<FeedBack> getFeedBack(int pageNum, int pageSize) throws SQLException {
        List<FeedBack> feedbackList = feedBackDao.getFeedBack(pageNum, pageSize);
        if (feedbackList.size() > pageSize) {
            feedbackList.remove(feedbackList.size() - 1); // 移除多余的一条记录
        }
        return feedbackList;
    }
}
